import random
import speech_recognition as sr

def get_user_choice():
    while True:
        print("请出拳（剪刀/石头/布）：")
        choice = speech_to_text()
        if choice in ['剪刀', '石头', '布']:
            return choice
        else:
            print("输入无效，请重新输入！")

def speech_to_text():
    recognizer = sr.Recognizer()
    with sr.Microphone() as source:
        audio = recognizer.listen(source)
    try:
        choice = recognizer.recognize_google(audio, language='zh-CN')
        return choice
    except sr.UnknownValueError:
        print("抱歉，无法识别您的语音！请重试。")
    except sr.RequestError:
        print("抱歉，无法连接到语音识别服务！")

# 其他部分与原代码相同...

play_game()
